package cate.game.play.skill.passive.fairy;

import cate.game.attr.FightAttr;
import cate.game.play.buff.Buff;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.proce.action.ctx.ActionCtx;
import cate.game.play.skill.passive.PassiveHandler;

/**
 * "月漫成双"提供的物理减伤调整为同等数值的伤害减免，
 */
public class 燕窝灵器PH extends PassiveHandler {

	private String buff标签;

	private int 原始属性;

	private int 替换属性;

	//buff标签=福祸与共&原始属性=21&替换属性=24
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		buff标签 = args.get("buff标签");
		原始属性 = args.getInt("原始属性", 0);
		替换属性 = args.getInt("替换属性", 0);
	}

	@Override
	public void adjustCastBuff(ActionCtx action, Buff otherBuff) {
		if (!otherBuff.cfg.containTag(buff标签)) {
			return;
		}
		double value = otherBuff.cfg.getExAttr().getTotalValue(原始属性);
		otherBuff.cfg.enhance.addExAttr(new FightAttr(原始属性, -value));
		otherBuff.cfg.enhance.addExAttr(new FightAttr(替换属性, value));
	}
}
